package kmi.droid.particles.sample;

import java.util.Random;

import kmi.droid.animatron.Vector2;
import kmi.droid.livewallpaper.cv.CanvasPaintingThread;

public class SimpleParticleSystem extends kmi.droid.animatron.ParticleSystem<SimpleParticle>
{
	private Random random = new Random();
	private CanvasPaintingThread painting = null;
	private int limit = 120;

	public SimpleParticleSystem(CanvasPaintingThread wp)
	{
		painting = wp;
	}

	@Override
	public void update(float dt)
	{
		if (particles.size() < limit)
		{
			SimpleParticle sp = new SimpleParticle(random.nextInt(25), 2000+5000*random.nextFloat(),
					random.nextInt());
			sp.setPosition(new Vector2(random.nextInt(painting.getWidth()),
					random.nextInt(painting.getHeight())));
			particles.add(sp);
		}
		super.update(dt);
	}

	@Override
	public boolean getIsAlive()
	{
		return true;
	}
}
